package work43;

import java.util.Scanner;

/**
 * @Author admin
 * @Date 2019/4/3 8:10
 */
public class Test {
    static SongDaoImp dao=new SongDaoImp();
    static Scanner sc1i=new Scanner(System.in);
    static Scanner sc2s=new Scanner(System.in);

    public static void main(String[] args) {
        System.out.println("-----点歌系统-----");
        System.out.println("0---添加歌曲");
        System.out.println("1---置顶歌曲");
        System.out.println("2---前移歌曲");
        System.out.println("3---退出");
        dao.init();
        System.out.println("请输入执行的序号");
        int a =sc1i.nextInt();
        switch (a){
            case 0:
                System.out.println("请输入添加的歌曲名称");
                String name=sc2s.nextLine();
                Song song=new Song(name);
                dao.add(song);
                dao.all();
                break;
            case 1:
                System.out.println("请输入要置顶的歌曲名称");
                name=sc2s.nextLine();
                dao.top(name);
                dao.all();

                break;
            case 2:
                System.out.println("请输入要前移的歌曲");
                name =sc2s.nextLine();
                Song music=dao.select(name);
                if (music==null){
                    System.out.println("当前歌曲列表没有此歌曲");
                }else {
                    dao.before(music);
                }
                dao.all();
                break;
            case 3:
                System.out.println("退出系统");
                System.exit(0);
                break;
                default:
                    System.out.println("输入有误");
        }
    }

}
